﻿using MediatR;
using S.EarTag.API.Application.MediatorCommand.BreedingWeighCommand;
using S.EarTag.Infrastructure.Repository.Interface.IEarTagRepository;

namespace S.EarTag.API.Application.MediatorCommandHandler.BreedingWeighCommandHandler
{
    /// <summary>
    /// 批量添加
    /// </summary>
    public class AddAllBreedingWeighCommandHandler : IRequestHandler<AddAllBreedingWeighCommand, bool>
    {
        private readonly IBreedingWeighRepository breedingWeighRepository;

        public AddAllBreedingWeighCommandHandler(IBreedingWeighRepository breedingWeighRepository)
        {
            this.breedingWeighRepository = breedingWeighRepository;
        }
        public async Task<bool> Handle(AddAllBreedingWeighCommand request, CancellationToken cancellationToken)
        {
            return await breedingWeighRepository.BatchAddBreedingWeigh(request.breedingHistoryModelsList);
        }


    }
}
